package com.qs.controller;


import com.qs.annotation.OperationLog;
import com.qs.response.Response;
import com.qs.service.IOrderCartService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 订单表和购物车表的一个关联表 前端控制器
 * </p>
 *
 * @author author
 * @since 2023-12-09
 */
@Slf4j
@CrossOrigin
@RestController
@RequestMapping("/order/cart")
@RequiredArgsConstructor
public class OrderCartController {

    private final IOrderCartService orderCartService;

    /**
     * 获取购物车id
     * @param orderId
     * @param userId
     * @return
     */
    @GetMapping("/get/cartId/{orderId}/{userId}")
    public Response getCartId(@PathVariable("orderId") String orderId,
                              @PathVariable("userId") Integer userId) {
        log.info("获取购物车id请求进来了------------");
        List<Integer> cartIds = orderCartService.getCartId(orderId, userId);
        return Response.success(cartIds);
    }
}
